from http.client import responses

from langchain_core.prompts import ChatPromptTemplate
from langchain_ollama import ChatOllama
from langchain_core.output_parsers import StrOutputParser

prompt = ChatPromptTemplate.from_template("请你用中文描述一下这个langchain？")

# 1、创建llm对象
llm = ChatOllama(model ="llama3")

# 2、创建一个langchain对象
parser = StrOutputParser()
chain = prompt | llm | parser

response = chain.invoke({})


# 输出 prompt
print(response)

